package com.redsoil.house.widget;

import android.content.Context;
import android.text.Html;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.TextView;

import com.redsoil.house.R;
import com.redsoil.house.app.AppContext;
import com.redsoil.house.model.bean.ReceiptListVO;
import com.zhy.autolayout.AutoLinearLayout;

/**
 * 作者：weidingqiang on 2019/1/26 11:27
 * 邮箱：weidingqiang@163.com
 */

public class HomeRemitItem extends AutoLinearLayout {

    private TextView payment_time_tv;

    private TextView profit_time_tv;

    private TextView money_tv;

    private TextView state_tv;

    public HomeRemitItem(Context context) {
        this(context,null);
    }

    public HomeRemitItem(Context context, AttributeSet attrs) {
        super(context, attrs);

        LayoutInflater inflater = LayoutInflater.from(context);
        inflater.inflate(R.layout.remit_list_item, this, true);

        payment_time_tv = (TextView) this.findViewById(R.id.payment_time_tv);

        profit_time_tv = (TextView) this.findViewById(R.id.profit_time_tv);

        money_tv = (TextView) this.findViewById(R.id.money_tv);

        state_tv = (TextView) this.findViewById(R.id.state_tv);
    }

    public void setData(ReceiptListVO.DataListBean item){


        payment_time_tv.setText(item.getPaymentTime());

        profit_time_tv.setText(item.getProfitInterval());

        String str;
        if(AppContext.getInstance().getCurrentMoneyType().equals("JPY")){
            str=item.getMoney();
        }else {
            str=item.getMoney()+"<br/><font color='#999999'>("+AppContext.getInstance().getCurrentMoneyType()+item.getTargetMoney()+")</font>";
        }

        money_tv.setText(Html.fromHtml(str));


        //已汇款：1，未汇款：2
        switch (item.getStatus()){
            case 1:
                state_tv.setText("已汇");
                break;
            case 2:
                state_tv.setText("未汇款");
                break;
        }
    }


}
